package com.example.cinema.repository;

import com.example.cinema.model.Schedule;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.util.Optional;

public interface ScheduleRepository extends JpaRepository<Schedule, Integer> {
    @Query("SELECT s FROM Schedule s JOIN FETCH s.movie WHERE s.id = :id")
    Optional<Schedule> findByIdWithMovie(Integer id);
}